package com.usian.service;

import com.usian.mapper.DeptMapper;
import com.usian.mapper.EmpMapper;
import com.usian.pojo.Dept;
import com.usian.pojo.Emp;
import com.usian.pojo.Empvo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpService {
    @Autowired
    private EmpMapper empMapper;
    @Autowired
    private DeptMapper deptMapper;
    public List<Empvo> findall(Emp emp){
        List<Empvo> findall = empMapper.findall(emp);
        return findall;
    }

    public void add(Emp emp) {
        empMapper.insertSelective(emp);
    }

    public void deletebyeid(Integer id) {
        empMapper.deleteByPrimaryKey(id);
       // empMapper.deletebyeid(id);
    }

    public Emp findbyid(Integer id) {
        return empMapper.selectByPrimaryKey(id);
    }

    public void updatebyemp(Emp emp) {
        empMapper.updateByPrimaryKeySelective(emp);
    }

    public List<Dept> finddept() {
        return deptMapper.selectAll();
    }


}
